package com.free.normal;

import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Cursor;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

/**
 * <p>
 * Title: Eclipse Plugin Development
 * </p>
 * <p>
 * Description: Free download
 * </p>
 * <p>
 * mail: ganshm@gmail.com
 * </p>
 */

public class HelloWorldButton
{
    public HelloWorldButton()
    {
        Display display = new Display();
        Shell shell = new Shell(display);
        
        // 指定父组件和按钮风格
        Button button = new Button(shell, SWT.NONE);
        // 指定按钮的位置
        button.setBounds(40, 50, 100, 30);
        // 指定按钮的显示标签
        button.setText("Click Me");
        
        shell.setSize(200, 200); // 窗口大小
        shell.open();
        
        // Set up the event loop.
        while (!shell.isDisposed())
        {
            if (!display.readAndDispatch())
            {
                // If no more entries in event queue
                display.sleep();
            }
        }
        
        display.dispose();
    }
    
    public static void main(String[] args)
    {
        new HelloWorldButton();
    }
}
